@extends('admin.layout.common')
@section('content')
	<link rel="stylesheet" type="text/css" href="{{URL::asset('css/music/amendSP.css')}}">
    <link rel="stylesheet" href="{{URL::asset('/css/app.css')}}">
	<div class="create_content">
		<h1>修改SP信息</h1>
		<form action="{{url('/admin/spList')}}" method="post">
			{{csrf_field()}}
			<label for="">SP简称<input type="text" name="simple_name" placeholder="请输入"></label>
			<label for="">联系人:<input type="text" name="phone_name" placeholder="请输入"></label>
			<label for="">签约日期:<input type="date" name="fix_date" placeholder="年/月/日"></label>
			<select name="main" style="width:157px;height:40px;">
				<option value="">主营业员选择</option>
				<option value="无">无主营业员</option>
				@foreach($saleList as $v)
					@if($v['type'] == 1)
					<option value="{{$v['name']}}">{{$v['name']}}</option>
					@endif
				@endforeach
			</select>
			<input type="submit" value="精确查找" class="find">
		</form>
		<table>
			<tr>
				<th>ID</th>
				<th>SP全称</th>
				<th>SP简称</th>
				<th>联系人</th>
				<th>主营业务员</th>
				<th>签约日期</th>
				<th>状态</th>
				<th>操作</th>
			</tr>
            @foreach($data as $k => $v)
			<tr>
				<td>{{$v->id}}</td>
				<td>{{$v->full_name}}</td>
				<td>{{$v->simple_name}}</td>
				<td>{{$v->phone_name}}</td>
				<td>{{$v->main}}</td>
				<td>{{$v->fix_date}}</td>
				@if($v->status == 1)
					<td>正常</td>
				@else
					<td>协议终止</td>
				@endif
				<td>
					<button class="btn-work" id="look">查看</button>
				</td>
			</tr>
			@endforeach
        </table>
        {{$data->links()}}
        <div id="demo3" style="position:absolute;bottom:0;right:0;font-size:18px;"></div>
	</div>
<script type="text/javascript" src="{{URL::asset('js/music/amendSP.js')}}"></script>
<script>
  $(function () {
    $('.btn-work').on('click', function() {
      var id = $(this).parent().parent().children(':first').html();

      //页面层
      layer.open({
        type: 2,
        skin: '', //加上边框
        area: ['60%', '900px'], //宽高
        content: '{{url('admin/sppop')}}' + '/' + id,
        end() {
          window.location.reload()
        }
      });
    });
  });
</script>
@endsection
